package com.tiny.work.plane;

import java.util.Date;

public class SpecialTimeOrderRuler implements IRuler<ArrangePilot> {

    @Override
    public boolean isMatch(ArrangePilot arrangePilot) {
        Pilot pilot = arrangePilot.getPilot();
        Date curTime = arrangePilot.curTime;
        int i = 0;
        Date date;
        do {
            date = DateUtils.addDay(pilot.getStartTime(), 28 * i);
            Date date3 = DateUtils.addDay(pilot.getStartTime(), 28 * i + 1);
            if (curTime.compareTo(date) >= 0 && curTime.compareTo(date3) <= 0) {
                return false;
            }
        } while (date.compareTo(DateUtils.toDate("2100-01-01 00:00:00")) < 0 && date.compareTo(curTime) > 0);
        return true;
    }
}
